package mobile;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import mda.type.IRegisterTemplates;
import flca.mda.codegen.data.ITemplate;
import flca.mda.codegen.data.SubsValue;
import flca.mda.codegen.data.TemplatesBranch;
import flca.mda.common.api.helpers.RegisterTemplatesHelper;

public class RegisterTemplates implements IRegisterTemplates {
	@Override
	public String getName() {
		return "mobile-app";
	}

	@Override
	public String getDescription() {
		return "Mobile App";
	}

	@Override
	public List<TemplatesBranch> getTemplateBranches() {
		List<TemplatesBranch> result = new ArrayList<TemplatesBranch>();

		result.add(makeMobileAppsBranch());

		return result;
	}

	private TemplatesBranch makeMobileAppsBranch() {
		TemplatesBranch result = new TemplatesBranch();
		result.setName("mobile-app");
		result.setDescription("Mobile App");

		for (TidMobile tid : TidMobile.values()) {
			ITemplate template = TidMobile.makeTemplate(tid);
			result.addTemplate(template);
		}

		return result;
	}

	private final static String[] ALL_MOBILE_CARTRIDGES = new String[] {MobileConstants.CARTRIDGE_NAME};
	private final static String MOBILE = MobileConstants.CARTRIDGE_NAME;
	
	@Override
	public Collection<SubsValue> getSubstituteValues() {
		return RegisterTemplatesHelper.getCommomSubsValues(MOBILE, ALL_MOBILE_CARTRIDGES);
	}


}
